package cz.cvut.testRMI;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class Client {
    public static void main(String args[]) {
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new SecurityManager());
        }
        try {
            String name = "MujServer";
            Registry registry = LocateRegistry.getRegistry();
            Common remote = (Common) registry.lookup(name);
            
            System.out.println(remote.secti(5, 6));
            
            Container honza = new Container("Jan", "Hana", "Dolnokubinska", 1671, "Pelhrimov", "Czech republic");
            honza = remote.changeDetails(honza);
            System.out.println(honza);
            
            remote.pockej(); // vzdaleny wait
            
            remote.end(); // ukonci vzdalene server :)
        } catch (Exception e) {
            System.err.println("MujServer exception:");
            e.printStackTrace();
        }
    }
}
